<template>
  <div>
    <p>提示：{{ this.$route.query.id }}</p>
    <el-input v-model="title" placeholder="请输入内容">{{title}}</el-input>
    <img :src="picture" alt="">
    <el-input v-model="date" placeholder="请输入内容"></el-input>
      <el-button type="primary" round @click="toIndex">保存</el-button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      id: "",
      title: "",
      picture: "",
      date: "",
    };
  },
  methods: {
      toIndex(){
          this.$router.push("/example/table")
      }
  },
  created() {
    this.id = this.$route.query.id;
    this.axios
      .post(
        "https://www.fastmock.site/mock/e95dac21145f7756a1c5d5095b4e6486/myblogAdmin/update",
        {
          id: this.id,
        }
      )
      .then((result) => {
        console.log(result.data);
        this.title = result.data.title;
        this.picture = result.data.image;
        this.date = result.data.date;
      })
      .catch((err) => {
        console.log(err);
      });
  },
};
</script>

<style>
</style>